package com.example.erp.utils;

import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;

public class MyUtils {
    public static List<Integer> diffList(List<Integer> firstArrayList, List<Integer> secondArrayList) {
        List<Integer> resultList = firstArrayList.stream()
                .filter(item -> !secondArrayList.stream()
                        .collect(Collectors.toList()).contains(item)
                )
                .collect(Collectors.toList());
        return resultList;
    }

    public static Double addDouble(Double a, Double b, Boolean isAdd){
        BigDecimal a1 = new BigDecimal(Double.toString(a));

        BigDecimal b2 = new BigDecimal(Double.toString(b));
        if(isAdd){
            return a1.add(b2).doubleValue();
        }else{
            return a1.subtract(b2).doubleValue();
        }

    }
}
